import { createApp } from 'vue'
import App from './App.vue'
// import { antArr } from "./AntDesign.js";
import router from './router'
import store from './store'
import Antd  from "ant-design-vue";
import Element from 'element-plus'
import 'element-plus/theme-chalk/index.css';
import './utils/rem'
import 'ant-design-vue/dist/antd.css';
import './style/common.scss'
import * as Icons from "@ant-design/icons-vue";
import SvgIcon from '@/components/SvgIcon'// svg component
import './icons'
import '@/permission' // 路由跳转控制
const app = createApp(App)

app.component('svg-icon', SvgIcon)


// 开始使用全局图标
for (const i in Icons) {
    // 循环注册组件
    app.component(i, Icons[i]);
}
app.use(store).use(router).use(Antd).use(Element).mount('#app')

const $_has = function(value) {
    if (!value) {
      return true;
    }
    let isExist = false;
    let buttonpermsStr = sessionStorage.getItem("buttenpremissions");
    isExist = false;
    if (buttonpermsStr == undefined || buttonpermsStr == null) {
      return false;
    }
    let buttonperms = JSON.parse(buttonpermsStr);
    for (let i = 0; i < buttonperms.length; i++) {
      if (buttonperms[i].perms == value) {
        isExist = true;
        break;
      }
    }
    return isExist;
  };
  app.provide('$_has', $_has);

